Skip to main content

All Questions

3votes
2answers
242views

Leetcode 14. Longest Common Prefix beats only ~50% of C++ solutions

The task is to find the longest common prefix. While I had no trouble to find the solution, I'm interested in the statistics of my code: Runtime: 7 ms, faster than 56.36% of C++ online submissions ...
infinitezero's user avatar
1vote
1answer
222views

Infix calculator programming challenge Kattis.com

I'm working on this C++ coding problem: Input is a sequence of up to commands, one per line, ending at end of file. Each command is a definition, a calculation, or a clear. All tokens within a ...
circuital's user avatar
1vote
2answers
144views

Function wrapper that prints the result

(English) I was recently challenged to make a simple program that does the following: Function f accepts as a parameter a function g, which returns a value. Function f must return a function h which ...
Noel's user avatar
4votes
3answers
385views

567: Permutation in String

I implemented a solution to the LeetCode problem: 567. Permutation in String The Problem Given two strings s1(queryStr) and s2(sourceStr), return true if s2 contains a permutation of s1, or false ...
Josh Sanders's user avatar
-2votes
1answer
259views

HackerRank frequency queries

need some help or advice, HackerRank's frequency-queries challenge, the challenge of this Hackerrank problem is to check if the frequencies of number in your data structure matches the queries. small ...
NaturalDemon's user avatar
1vote
1answer
274views

MSD Radix sort in Place in c++, Object/Pointer Oriented

Memory:O(log(max)base(mod)*mod)Speed:O(log(max)base(mod)*n) I did a radix sort in place to not get a auxliar array. In the process i discorver a few things. Is imposible to do LSD radix sort in place ...
bigotes0invisibles's user avatar
4votes
2answers
3kviews

10 Kinds of People Open Kattis Problem Time Limit Exceeded C++

I am trying to solve the open kattis problem '10 kinds of people' (https://open.kattis.com/problems/10kindsofpeople) using a best-first search algorithm and c++. 10 Kinds of People The world is made ...
Filip Voss Åkerström's user avatar
3votes
1answer
290views

Number of inversions on a segment

I was trying to do this question and I get TLE on one the test cases (the actual link to the question will ask you to login). What is an inversion? An inversion of an element is the number of ...
Tilak Madichetti's user avatar
8votes
4answers
477views

Calculate sum of multiple series within array

The exercise is as follows: Player A will write list \$ a \$ consisting of \$ n \$ numbers. Player B will take a look at the paper. After that the A player will ask player B \$q\$ questions. Each ...
user229175's user avatar
1vote
1answer
888views

LeetCode 809: Expressive Words

I'm posting my C++ code for LeetCode's Expressive Words. If you have time and would like to review, please do so. Thank you! Sometimes people repeat letters to represent extra feeling, such as "...
Emma's user avatar
  • 3,592
1vote
1answer
323views

LeetCode 76: Minimum Window Substring

I'm posting an sliding window problem of LeetCode (Minimum Window Substring) with C++. If you have time and would like to review the code, please do so, I appreciate that. On LeetCode, we are only ...
Emma's user avatar
  • 3,592
6votes
2answers
120views

Program for activity selection exceeds time limit

I've been trying to solve this problem for some while and the solution I have come up with exceeds the lime limit by 1-3 ms and 2 out of 10 tests get a memory issue error. Why is that? This is the ...
antoniu200's user avatar
10votes
2answers
3kviews

Project Euler #7 10001st prime in C++

By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? How can I optimize this code? ...
coder's user avatar
  • 2,461
1vote
2answers
151views

Segmented Sieve Spoj

I tried(trying...) to solve the SPOJ prime number problem PRIME1 so i learned and implemented Segmented Sieve correctly but this program works in time for 10^8 but getting Time limit exceeded (TLE) ...
Syntax Hacker's user avatar
3votes
1answer
99views

(Follow-up) Project Euler #11 Largest Product in a Grid | Cache-optimized + sliding window (C++14)

Original code review: Project Euler #11 Largest Product in a Grid | Cache-optimized + sliding window (C++14) Source: HackerRank & ProjectEuler.net Problem: Largest Product in a Grid In the 20×...
Eric's user avatar
  • 261

153050per page
close